Note: Used sliding window of 100ms (50ms on each side)
library(ggplot2)
source('clean.r')
source('misc.r') # sliding window function
# import data
data_20day <- clean_20day()
# remove bad trials
data_20day <- data_20day[PrepTime > 0 & ResponseButton < 5 & PrepTime < 5]
# subset data to relevant bit
data_20day_tr <- data_20day[Session >= 24 & !IsToCriterion & !IsFreeResp]
# Session 24 is the last timed response before the switch,
# 25 is the criterion (removed), and 26 is timed response to remap
# any greater than 26 need to be determined
# calculate sliding window per subject,
# and population-level per session
data_20day_tr[, SlideIndividual := slider(PrepTime, Correct, window_size = 0.1),
by = c('Session', 'WillRemap', 'Subject')]
data_20day_tr[, SlidePop := slider(PrepTime, Correct, window_size = 0.1),
by = c('Session', 'WillRemap')]
We can look at the frequency of IsRemapped to try and take a guess at what happened when…
tmp <- data_20day[Session > 24]
table(paste0('Remapped: ', tmp$IsRemapped, ', Free Resp: ', tmp$IsFreeResp), tmp$Session, tmp$Subject)
## , , = 101
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 249 0 0 0 0 0
## Remapped: FALSE, Free Resp: TRUE 44 250 500 500 500 0 0
## Remapped: TRUE, Free Resp: FALSE 0 247 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 47 250 500 500 500 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 102
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 243 0 0 0 248 0
## Remapped: FALSE, Free Resp: TRUE 25 250 500 500 500 250 1000
## Remapped: TRUE, Free Resp: FALSE 0 247 0 0 0 244 0
## Remapped: TRUE, Free Resp: TRUE 28 250 500 500 500 250 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 497
## Remapped: FALSE, Free Resp: TRUE 500
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 103
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 250 0 499 0 0 0
## Remapped: FALSE, Free Resp: TRUE 20 250 1000 500 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 249 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 20 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 104
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 235 0 0 0 242 0
## Remapped: FALSE, Free Resp: TRUE 12 250 500 500 500 250 1000
## Remapped: TRUE, Free Resp: FALSE 0 235 0 0 0 240 0
## Remapped: TRUE, Free Resp: TRUE 13 249 500 500 500 250 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 464
## Remapped: FALSE, Free Resp: TRUE 500
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 105
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 250 0 0 0 0 0
## Remapped: FALSE, Free Resp: TRUE 25 250 1000 0 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 248 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 25 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 106
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 248 0 499 0 0 0
## Remapped: FALSE, Free Resp: TRUE 12 250 1000 500 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 249 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 11 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 107
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 243 0 484 0 0 0
## Remapped: FALSE, Free Resp: TRUE 12 250 1000 500 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 246 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 13 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 108
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 244 0 492 0 0 0
## Remapped: FALSE, Free Resp: TRUE 48 250 1000 500 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 248 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 49 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 110
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 244 0 0 0 238 0
## Remapped: FALSE, Free Resp: TRUE 43 250 500 500 500 250 1000
## Remapped: TRUE, Free Resp: FALSE 0 231 0 0 0 244 0
## Remapped: TRUE, Free Resp: TRUE 44 250 500 500 500 250 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 481
## Remapped: FALSE, Free Resp: TRUE 500
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 111
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 249 0 498 0 0 0
## Remapped: FALSE, Free Resp: TRUE 25 250 1000 500 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 247 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 26 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 112
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 243 0 492 0 0 0
## Remapped: FALSE, Free Resp: TRUE 28 250 1000 500 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 243 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 26 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 113
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 241 0 0 0 0 0
## Remapped: FALSE, Free Resp: TRUE 69 250 500 500 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 240 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 70 250 500 500 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 114
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 250 0 0 0 0 0
## Remapped: FALSE, Free Resp: TRUE 43 250 0 0 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 241 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 44 250 0 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
##
## , , = 115
##
##
## 25 26 27 28 29 30 31
## Remapped: FALSE, Free Resp: FALSE 0 249 0 0 0 0 0
## Remapped: FALSE, Free Resp: TRUE 44 250 250 0 0 0 0
## Remapped: TRUE, Free Resp: FALSE 0 247 0 0 0 0 0
## Remapped: TRUE, Free Resp: TRUE 47 250 750 0 0 0 0
##
## 32
## Remapped: FALSE, Free Resp: FALSE 0
## Remapped: FALSE, Free Resp: TRUE 0
## Remapped: TRUE, Free Resp: FALSE 0
## Remapped: TRUE, Free Resp: TRUE 0
My guesses: 101 - 3 days of remapping training (27-29), no TR 102 - 3 days of remapping training (27-29), remapped TR on 30, 1 day training on original (31), original TR on 32 103 - 1 day of original training (27), original TR on 28 104 - Like 102 105 - 1 day of original training, no TR 106 - like 103 107 - like 103 108 - like 103 110 - like 102 111 - like 103 112 - like 103 113 - 2 days of remapping training (27-28), no TR 114 - Nothing past session 26 115 - 1 day remapping training, no TR (and seems like there were more remapped than non-remapped trials? Will look again)
plotfn_pop <- function(data, title = '') {
ggplot(data, aes(x = PrepTime,
y = SlidePop,
colour = factor(WillRemap))) +
geom_hline(linetype = 'longdash', yintercept = 0.25) +
geom_line(size = 1) +
xlim(c(0, 1)) +
labs(x = 'Reaction Time (s)', y = 'Proportion Correct', title = title)
}
plotfn_ind <- function(data, title = '') {
ggplot(data, aes(x = PrepTime,
y = SlideIndividual,
colour = factor(WillRemap))) +
geom_hline(linetype = 'longdash', yintercept = 0.25) +
facet_wrap(~Subject, ncol = 3) +
geom_histogram(aes(fill = factor(WillRemap),
y = ..count../(max(..count..) * 2)),
binwidth = 0.01,
alpha = 0.4,
position = 'identity') +
geom_line(size = 1) +
xlim(c(0, 1)) +
labs(x = 'Reaction Time (s)', y = 'Proportion Correct', title = title)
}
plotfn_pop(data_20day_tr[Session == 24], 'Remapped vs non-remapped, pre-remapping, after 4 weeks')
plotfn_ind(data_20day_tr[Session == 24], 'As above, but per individual')
plotfn_pop(data_20day_tr[Session == 26], 'Remapped vs non-remapped, post-remapping')
plotfn_ind(data_20day_tr[Session == 26], 'As above, per individual')
extended_training <- data_20day_tr[Subject %in% c(102, 104, 110)]
immediate_back <- data_20day_tr[Subject %in% c(103, 106, 107, 108, 111, 112)]
plotfn_pop(extended_training[Session == 30])
plotfn_ind(extended_training[Session == 30])
plotfn_pop(extended_training[Session == 32])
plotfn_ind(extended_training[Session == 32])
plotfn_pop(immediate_back[Session == 28])
plotfn_ind(immediate_back[Session == 28])